package Chapter2.Comparing.c1;

public class TestInstance {
    public static void method1(Person e){
        if(e instanceof Person){
            System.out.println("A person.");
        }
        if(e instanceof Student){
            System.out.println("A person.");
            System.out.println("A student.");
        }
        if(e instanceof Graduate){
            System.out.println("A person.");
            System.out.println("A student.");
            System.out.println("a graduated student");
        }
    }

    public static void main(String[] args) {
        Student s1 = new Student();
        Person p1 = new Student();
        Person p2 = new Graduate();

        method1(s1);
        method1(p1);
        method1(p2);

    }
}
